package com.huifaapp.mall.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.huifaapp.mall.R;
import com.huifaapp.mall.bean.PubliCountBean;
import com.huifaapp.mall.bean.TeamBean;
import com.jcodecraeer.xrecyclerview.XRecyclerView;

import java.util.List;

/**
 * Created by duanyu on 2018/2/2.
 */

public class PublicCountAdapter extends XRecyclerView.Adapter<PublicCountAdapter.MyViewHolder> {
    private List<PubliCountBean.DataBean.ListBean>  list;
    private Context context;

    public PublicCountAdapter(List<PubliCountBean.DataBean.ListBean> list, Context context) {
        this.list = list;
        this.context = context;
    }

    @Override
    public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View recyclerViewItem = LayoutInflater.from(context).inflate(R.layout.itme_tmall_publicount,parent, false);
        return new MyViewHolder(recyclerViewItem);
    }

    @Override
    public void onBindViewHolder(MyViewHolder holder, int position) {
        Log.e("邀请记录","邀请记录===="+list.size()+"     "+position);
        holder.itme_tmall_publicount_userName.setText(list.get(position).getUserName());
        holder.itme_tmall_publicount_inviteName.setText(list.get(position).getInviteName());
        holder.itme_tmall_publicount_creatTime.setText(list.get(position).getCreatTime());
    }


    @Override
    public int getItemCount() {
        return list == null ? 0 : list.size();
    }
    class MyViewHolder extends RecyclerView.ViewHolder {


        private final TextView itme_tmall_publicount_userName;
        private final TextView itme_tmall_publicount_inviteName;
        private final TextView itme_tmall_publicount_creatTime;

        public MyViewHolder(View itemView) {
            super(itemView);
            itme_tmall_publicount_userName = (TextView) itemView.findViewById(R.id.itme_tmall_publicount_userName);
            itme_tmall_publicount_inviteName = (TextView) itemView.findViewById(R.id.itme_tmall_publicount_inviteName);
            itme_tmall_publicount_creatTime = (TextView) itemView.findViewById(R.id.itme_tmall_publicount_creatTime);
        }

    }
}
